package api

import (
	"github.com/gin-gonic/gin"
	"xiaohongshu-article/api/handler"
	"xiaohongshu-article/api/middleware"
)

func LoadRouter(r *gin.Engine) {

	api := r.Group("/api")
	{
		user := api.Group("/user")
		{
			user.POST("register", handler.RegisterUser)
			user.POST("sendSms", handler.SendSmsUser)
			user.POST("login", handler.LoginUser)
			user.Use(middleware.Auth())
			user.GET("show", handler.ShowUser)
		}

		article := api.Group("/article")
		{
			article.POST("add", handler.AddArticle)
			article.GET("list", handler.ListArticle)
			article.GET("show", handler.ShowArticle)
		}

	}

}

/*
r.GET("/ping", func(c *gin.Context) {
		c.JSON(200, gin.H{
			"message": "pong",
		})
	})
*/
